﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;


namespace FAP.DataAccess.BLL
{
    public class chitietnghiepvu
    {
        public int id { get; set; }
        public int nghiepvuid { get; set; }
        public int websiteid { get; set; }
        public int trangthai { get; set; }
        public bool isdeleted { get; set; }
        //public nghiepvu nghiepvu { get { return nghiepvu.nghiepvuSelectRow(nghiepvuid); } }
        //public website website { get { return website.websiteSelectRow(websiteid); } }
        //public List<buocthuchien> buocthuchiens { get { return buocthuchien.buocthuchienSelectRowByForeignKey_chitietnghiepvuid(id); } }

        #region chitietnghiepvuSelectAll
        public static List<chitietnghiepvu> chitietnghiepvuSelectAll()
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietnghiepvuSelectAll();
            List<chitietnghiepvu> chitietnghiepvuList = new List<chitietnghiepvu>();
            while (dr.Read())
            {
                chitietnghiepvu mychitietnghiepvu = new chitietnghiepvu
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    nghiepvuid = !dr.IsDBNull(dr.GetOrdinal("nghiepvuid")) ? (int)dr["nghiepvuid"] : 0,
                    websiteid = !dr.IsDBNull(dr.GetOrdinal("websiteid")) ? (int)dr["websiteid"] : 0,
                    trangthai = !dr.IsDBNull(dr.GetOrdinal("trangthai")) ? (int)dr["trangthai"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false
                };
                chitietnghiepvuList.Add(mychitietnghiepvu);
            }
            dr.Close();
            dr.Dispose();
            return chitietnghiepvuList;
        }
        #endregion

        #region chitietnghiepvuSelectRow
        public static chitietnghiepvu chitietnghiepvuSelectRow(int id)
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietnghiepvuSelectRow(id);
            chitietnghiepvu chitietnghiepvu = null;

            if (dr.Read())
            {
                chitietnghiepvu = new chitietnghiepvu
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    nghiepvuid = !dr.IsDBNull(dr.GetOrdinal("nghiepvuid")) ? (int)dr["nghiepvuid"] : 0,
                    websiteid = !dr.IsDBNull(dr.GetOrdinal("websiteid")) ? (int)dr["websiteid"] : 0,
                    trangthai = !dr.IsDBNull(dr.GetOrdinal("trangthai")) ? (int)dr["trangthai"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false,

                };
            }
            dr.Close();
            dr.Dispose();
            return chitietnghiepvu;
        }
        #endregion

        #region chitietnghiepvuSelectRowByForeignKey_nghiepvuid
        public static List<chitietnghiepvu> chitietnghiepvuSelectRowByForeignKey_nghiepvuid(int nghiepvuid)
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietnghiepvuSelectRowByForeignKey_nghiepvuid(nghiepvuid);
            List<chitietnghiepvu> chitietnghiepvuList = new List<chitietnghiepvu>();
            while (dr.Read())
            {
                chitietnghiepvu mychitietnghiepvu = new chitietnghiepvu
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    nghiepvuid = !dr.IsDBNull(dr.GetOrdinal("nghiepvuid")) ? (int)dr["nghiepvuid"] : 0,
                    websiteid = !dr.IsDBNull(dr.GetOrdinal("websiteid")) ? (int)dr["websiteid"] : 0,
                    trangthai = !dr.IsDBNull(dr.GetOrdinal("trangthai")) ? (int)dr["trangthai"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false
                };
                chitietnghiepvuList.Add(mychitietnghiepvu);
            }
            dr.Close();
            dr.Dispose();
            return chitietnghiepvuList;
        }
        #endregion

        #region chitietnghiepvuSelectRowByForeignKey_websiteid
        public static List<chitietnghiepvu> chitietnghiepvuSelectRowByForeignKey_websiteid(int websiteid)
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietnghiepvuSelectRowByForeignKey_websiteid(websiteid);
            List<chitietnghiepvu> chitietnghiepvuList = new List<chitietnghiepvu>();
            while (dr.Read())
            {
                chitietnghiepvu mychitietnghiepvu = new chitietnghiepvu
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    nghiepvuid = !dr.IsDBNull(dr.GetOrdinal("nghiepvuid")) ? (int)dr["nghiepvuid"] : 0,
                    websiteid = !dr.IsDBNull(dr.GetOrdinal("websiteid")) ? (int)dr["websiteid"] : 0,
                    trangthai = !dr.IsDBNull(dr.GetOrdinal("trangthai")) ? (int)dr["trangthai"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false
                };
                chitietnghiepvuList.Add(mychitietnghiepvu);
            }
            dr.Close();
            dr.Dispose();
            return chitietnghiepvuList;
        }
        #endregion

        #region chitietnghiepvuSelectRowByForeignKey_nghiepvuid_websiteid
        public static List<chitietnghiepvu> chitietnghiepvuSelectRowByForeignKey_nghiepvuid_websiteid(int nghiepvuid, int website)
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietnghiepvuSelectRowByForeignKey_nghiepvuid_websiteid(nghiepvuid, website);
            List<chitietnghiepvu> chitietnghiepvuList = new List<chitietnghiepvu>();
            while (dr.Read())
            {
                chitietnghiepvu mychitietnghiepvu = new chitietnghiepvu
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    nghiepvuid = !dr.IsDBNull(dr.GetOrdinal("nghiepvuid")) ? (int)dr["nghiepvuid"] : 0,
                    websiteid = !dr.IsDBNull(dr.GetOrdinal("websiteid")) ? (int)dr["websiteid"] : 0,
                    trangthai = !dr.IsDBNull(dr.GetOrdinal("trangthai")) ? (int)dr["trangthai"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false,
                };
                chitietnghiepvuList.Add(mychitietnghiepvu);
            }
            return chitietnghiepvuList;
        }
        #endregion

        #region chitietnghiepvuInsertRow
        public static void chitietnghiepvuInsertRow(int nghiepvuid, int websiteid, int trangthai, bool isdeleted)
        {
            FAP.DataAccess.DAL.chitietnghiepvuInsertRow(nghiepvuid, websiteid, trangthai, isdeleted);
        }
        #endregion

        #region chitietnghiepvuUpdateRow
        public static void chitietnghiepvuUpdateRow(int id, int nghiepvuid, int websiteid, int trangthai, bool isdeleted)
        {
            FAP.DataAccess.DAL.chitietnghiepvuUpdateRow(id, nghiepvuid, websiteid, trangthai, isdeleted);
        }
        #endregion

        #region chitietnghiepvuDeleteRow
        public static void chitietnghiepvuDeleteRow(int id)
        {
            FAP.DataAccess.DAL.chitietnghiepvuDeleteRow(id);
        }
        #endregion
    }
}